package com.qf.mvc01.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/product")
public class ProductController {

    @RequestMapping("/test1")
    public Map<String,String> test1(HttpServletRequest req) throws InterruptedException {
        Map<String,String> map = new HashMap<>();
      /*  String token = req.getHeader("token");
        if(token!=null){
            map.put("state","ok");
        }else {
            map.put("state","fail");
        }*/
        map.put("state","ok");
        Thread.sleep(2000);
        return map;

    }


    @RequestMapping("/del")
    public Map<String,String> delProduct(HttpServletRequest request) {
        Map<String,String> map = new HashMap<>();
        map.put("code", "1");
        map.put("msg", "ok");
        return map;
    }
}
